package city.spring.modules.cardinfo.repository;

import city.spring.modules.cardinfo.entity.PhysicalCardChangeLogEmEntity;
import city.spring.modules.cardinfo.vo.PhysicalCardChangeLogEmEntityVO;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

/**
 * 存储库：员工物理卡号更换记录
 *
 * @author pxm
 * @date 2020-12-25 11:53:52
 */
@Repository
public interface PhysicalCardChangeLogEmRepository extends BaseMapper<PhysicalCardChangeLogEmEntity> {
    /**
     * 计算累积更换次数
     *
     * @param personId
     * @return
     */
    int changeCount(String personId);

    /**
     * 分页获取的物理卡号更换记录
     *
     * @param page
     * @param wrapper
     * @return
     */
    IPage<PhysicalCardChangeLogEmEntityVO> staffListPage(Page<? extends PhysicalCardChangeLogEmEntity> page, @Param(Constants.WRAPPER) Wrapper<? extends PhysicalCardChangeLogEmEntity> wrapper);
}